import java.util.Random;

public class CTable
{
	CCard[] cards_Deck = new CCard[52];
	int[] cards_PointerDeck=new int[52];
	int int_PointerDeck;
	
	public CTable()
	{	
		int k=0;
		CCard.enum_ColorOfCard coc_Support = CCard.enum_ColorOfCard.COC_NULL;
		CCard.enum_ValueOfCard voc_Support = CCard.enum_ValueOfCard.VOC_NULL;
		
		for(int i=0; i<4; i++)
		{
				if(i==0) coc_Support = CCard.enum_ColorOfCard.COC_CLUB;
				else if (i==1) coc_Support = CCard.enum_ColorOfCard.COC_DIAMOUND;
				else if (i==2) coc_Support = CCard.enum_ColorOfCard.COC_HEART;
				else if (i==3) coc_Support = CCard.enum_ColorOfCard.COC_SPADE;
				
			for(int j=0; j<13;j++)
			{
				  if(j==0) voc_Support = CCard.enum_ValueOfCard.VOC_TWO;
					else if (j==1) voc_Support = CCard.enum_ValueOfCard.VOC_THREE;
					else if (j==2) voc_Support = CCard.enum_ValueOfCard.VOC_FOUR;
					else if (j==3) voc_Support = CCard.enum_ValueOfCard.VOC_FIVE;
					else if (j==4) voc_Support = CCard.enum_ValueOfCard.VOC_SIX;
					else if (j==5) voc_Support = CCard.enum_ValueOfCard.VOC_SEVEN;
					else if (j==6) voc_Support = CCard.enum_ValueOfCard.VOC_EIGHT;
					else if (j==7) voc_Support = CCard.enum_ValueOfCard.VOC_NINE;
					else if (j==8) voc_Support = CCard.enum_ValueOfCard.VOC_TEN;
					else if (j==9) voc_Support = CCard.enum_ValueOfCard.VOC_JACK;
					else if (j==10) voc_Support = CCard.enum_ValueOfCard.VOC_QUEEN;
					else if (j==11) voc_Support = CCard.enum_ValueOfCard.VOC_KING;
					else if (j==12) voc_Support = CCard.enum_ValueOfCard.VOC_ACE;

					cards_Deck[k] = new CCard(coc_Support,voc_Support);	

				    cards_Deck[k] = new CCard(coc_Support,voc_Support);
				    k++;
			}

		}
	}
	
	public void shuffling()
	{
		int j=0;
		int[] losowanie = new int[52];
		Random generator = new Random();
		for(int i = 0 ; i < 52; i++) losowanie[i] = i;              
		for(int i = 52; i > 0; i--) 
		{ 
		  int index = generator.nextInt(i); 
		  cards_PointerDeck[j]=losowanie[index]; 
		  losowanie[index] = losowanie[i-1];
		  j++;
		} 
		int_PointerDeck = 0;
	}
	public CCard card_GrabCard()
	{
		++int_PointerDeck;
		return cards_Deck[cards_PointerDeck[int_PointerDeck-1]];

	}
	
	public CCard[] SendCard(int int_HowMany)
	{
		CCard[] cards_Result = new CCard[int_HowMany];
		
		for(int i=0;i<int_HowMany;++i)
		{
			cards_Result[i]= new CCard();
			cards_Result[i]=card_GrabCard();
		}
		return cards_Result;
	}
}
